package api

import (
	"go-gw-scaffold/dto"
	"log"

	"github.com/gin-gonic/gin"
)

func CreateServer(serverOptions *dto.ServerOptions, callback func(engine *gin.Engine)) *gin.Engine {
	if callback == nil {
		log.Fatal("callback is nil")
		return nil
	}
	engine := gin.Default()
	callback(engine)
	log.Println("HTTP Server Is Running On :: " + serverOptions.Host + ":" + serverOptions.Port)
	engine.Run(":" + serverOptions.Port)
	return engine
}
